<?php


namespace app\cms\community\thirdPartyApi\aliyun\OSS;


use app\cms\community\thirdPartyApi\aliyun\lib\config;
use OSS\Core\OssException;
use OSS\OssClient;

class OSSBase
{

    protected OssClient $ossClient;
    protected array $config = [];

    /**
     * @throws OssException
     */
    public function __construct(
        protected config $configObject
    ){
        $this->config = $this->configObject -> getConfig();
        $this->ossClient = new OssClient(
            $this->config['access-key-id'],
            $this->config['access-key-secret'],
            $this->config['endpoint'],
            !(intval($this->config['is-cname']) === 0),
            $this->config['security-token'],
            $this->config['request-proxy']
        );
    }
}